Loading...
 

Lists and reports

Lists and reports

ClassiX offers a uniform concept for the display and output of lists, which consists of three parts. On the one hand, there is the module that defines the list and the search. Then there is the report, which can be based on its own column definition and database. Thirdly, there is the reporting module, which creates the interface between the module and the report.

Module structure

In the following, the elements of which the module is composed are described.

Required Widgets

The following widgets are required in a module to display report-dependent lists:

  • ObjectListView for displaying the list (No special flags need to be set, this is just an example):
    ObjectListView(ListBox, SELECT_MULTIPLE, ACCEPT_DROP, AUTO_POSITION, 7, 60, 561, 120)
  • The optional prompt named"DefaultReportListBoxPmt" is displayed when the default list is selected:
    Prompt(DefaultReportListBoxPmt, 10, 71, T("Default List", " Default List"))

    If there are several list boxes in a window, the prompts can be defined individually for each list box. To do this, the related widgets (list box and prompts) must be defined in a group or compsite. The identifier for the prompts must begin with"DefaultReportListBoxPmt" or"SpecifiedReportListBoxPmt".

  • The optional prompt named"SpecifiedReportListBoxPmt" is updated and displayed with the selected report name:
    Prompt(SpecifedReportListBoxPmt, HIDDEN, RED, 7, 30, T("Report specific List", "Report specific List")).
  • The optional button for advanced search, allowing query queries over list to be defined and executed.

    "Erweiterte Suche\"-Button
    Button(ExpandedSearchBtn, 1200, 11, 200, 7, T("Erweiterte Suche", "Expanded search")) [ SELECT: "CX_PERSON" "" INVALID INVALID INVALID INVALID Widget(, ListBox) SendMsg(ADVANCED_SEARCH) ]

  • Definition of a menu item, button or toolbar button for selecting a report and exporting the data to the clipboard, Excel or HTML.

    Clipboard button
    Button(CopyClipboardButton, TOOLTIP("Alle Kunden in die Zwischenablage kopieren", "Copy to clipboard"), 0, 0, "copytoclipboard.bmp") [ SELECT: // Call report service NULL // set standard report variables first [ projectSetup::GetCyberEnterprise Copy(partner.Name(6)) // cxVar04 = Mandant projectSetup::GetUser_ Dup if { Copy(partner.Name(6)) } else { Drop "" } // cxVar03 = Bearbeiter CreateTransObject(CX_TIME) String // cxVar02 = Uhrzeit CreateTransObject(CX_DATE) String // cxVar01 = Datum ] # "CX_CUSTOMER" Widget(, ListBox) SendMsg(PRINT_REPORT) ]

    Parameters for calling SendMsg(PRINT_REPORT):

    TopDefinition of the ListBox or TreeBox widget to be used for displaying the list.
    Top - 1

    Name of the data connector whose reports are to be used.
    If several lists are to be displayed in a window or notebook and the prompts are to be defined for each list. They can be defined as follows:

    • When calling the message "PRINT_REPORT", the report type is transferred, e.g. "CX_EXAMPLE". If you want to define several lists, you must assign each list its own report type. To make the connection of the lists in the type clear, you can name the types e.g. "CX_EXAMPLE_UP", "CX_EXAMPLE_DOWN" etc.
    • For the assignment of the prompts, the string after the last "_" is important, i.e. the prompt "DefaultReportListBoxPmt_UP" is assigned to the list "CX_EXAMPLE_UP".
    Top - 2

    Header data for a possible BIRT report.

    Top - 3NULL - this parameter is not used, therefore NULL should be passed here.

Definition : ListView

The standard list is the list that is usually visible by default and which the user uses to work in ClassiX. The column definitions are made with the procedure SetListBox. The messages SAVE_FORMAT and RESET_FORMAT are triggered by the menu items "Save format" and "Reset format" in the burger of the list and enable user-dependent formatting (selection of columns, sorting) to be saved. These are reloaded in the INITIALIZE via the provider call report::SetListboxByReport.

Definition of standard list
Prompt(DefaultReportListBoxPmt, 15, 11, T("Standard Liste", "Default List")) Prompt(SpecifedReportListBoxPmt, HIDDEN, RED, 15, 11, T("Berichtsabhängige Liste", "Report specific List")) Button(ExpandedSearchBtn, 1200, 11, 200, 7, T("Erweiterte Suche", "Expanded search")) [ SELECT: "CX_PERSON" "" INVALID INVALID INVALID INVALID Widget(, ListBox) SendMsg(ADVANCED_SEARCH) ] ObjectListView(ListBox, OPTIMIZE, SELECT_MULTIPLE, BITMAP_SIZE, DRAG_COPY, HZ_SCROLL_BAR, AUTO_POSITION, 15, 22, 980, 117) [ INITIALIZE: SetListBox "CX_PERSON" NULL Widget cxReport::SetListboxByReport Drop SAVE_FORMAT : "CX_PERSON" Widget cxReport::SaveActiveFormatAsUserDefaultReport RESET_FORMAT: Widget cxReport::SetListboxByDefault RELOAD_FORMAT: Widget(, StartButton) SendMsg(SELECT, DIRECT) REPORT_LIST: EndTXN BeginTXN(READ) // NULL is necessary for compatible call NULL // set standard report variables first [ cyberEnterprise Dup if Copy(partner.Name(6)) else { Drop "" } // cxVar04 = Mandant user if { user Copy(partner.Name(6)) } else "" // cxVar03 = Bearbeiter CreateTransObject(CX_TIME) String // cxVar02 = Uhrzeit CreateTransObject(CX_DATE) String // cxVar01 = Datum ] # Widget Copy(default.report) Widget SendMsg(PRINT_REPORT) ]
Receive message
MessageDescription
SAVE_FORMATMessage is tricked when "Save list format" is clicked in the menu.
RESET_FORMATMessage is tricked when "Reset list format" is clicked in the menu.
RELOAD_FORMAT

This message is triggered when the list format is reset.

Is only necessary if the structure of the standard list has been defined with different format names.

REPORT_LISTMessage is trilled when "Output list" is clicked in the menu.
DEPLOY_FORMATThis message is displayed after setting a new format via the report selection window.
LIST_VIEW_COLLECTION_SELECTEDThis list is sent upon selecting a saved list with the CX_LIST_VIEW_COLLECTION object on the stack.
Slots that are set automatically.
Slot nameDescription
default.formatCurrent default format of the lisbox
reported.masterObjectThe report used to set the default format.
accessPathDescription of the report
exported.accessPathFile name for exporting the list via Excel or HTM.

The macro SetListBox defines the standard format and, if necessary, the standard sorting of the list box.

Macro SetListBox
Define(SetListBox) ResetWindow [ Path(CX_LINK_TXN::TopTransaction().uniqueID) HEADER T("Warenkorb", "Shopping cart") ] SetFormat [ Path(CX_LINK_TXN::TopTransaction().shortName) HEADER T("Name", "Name") ] SetFormat [ "TopTransaction().uniqueID" ] SetSort ;

Definition : User setting Standard display

The burger menu at the top right of the list offers the possibility to select the displayed columns and to reset the list format and sorting. If these format changes are to be permanently adopted, the menu item "Save list format" must be selected.

Definition: Advanced search

The advanced search is a simple way to execute a query similar to SQL for data defined via a list and a data connector. The results can be exported in Excel and HTML format or transferred to the calling list.
Example for the definition of the button:

Example for SendMsg(ADVANCED_SEARCH)
Button(ExpandedSearchBtn, 870, 22, 200, 7, T("Erweiterte Suche", "Expanded search")) [ SELECT: CX_REPORT" ""; INVALID INVALID INVALID INVALID Widget(, ListBox) SendMsg(ADVANCED_SEARCH) ]

Parameters for calling SendMsg(ADVANCED_SEARCH): see
Definition: Export as Excel file

The content of a ListBox can be exported directly as an Excel file in XLSX format with only one provider call. No Excel version is necessary for this. The slot "exported.accessPath" on the widget or the description of the group/window is taken for the file name.

Example for the definition of the button:
Button(ExportBtn, TOOLTIP("Selektierte oder alle Positionen Export", "Export selected or all items"), 30, 140, 200, 8, T("E&xport nach Excel", "E&xport into Excel")) [ SELECT: EndTXN BeginTXN(READ) TRUE GetObjectsSelected(, FoundObjectsWinListBox) # Cardinality if TRUE else FALSE Widget(, FoundObjectsWinListBox) excelFile::ExportObjectListIntoExcelFile ]

Parameters for calling excelFile::ExportObjectListIntoExcelFile:

TopDefinition of the ListBox or TreeBox widget to be used for exporting the list.
Top - 1TRUE - Only the selected items will be exported.
FALSE - All items in the list are exported.
Top - 2

TRUE - List headers are taken over
FALSE - Without list headers

Definition: Export as HTML file

The content of a ListBox can be exported directly as an HTML file in a table with only one provider call. The slot "exported.accessPath" on the widget or the description of the group/window is taken for the file name.

Example for the definition of the button:
Button(ExportHTMLBtn, TOOLTIP("Selektierte oder alle Positionen Export", "Export selected or all items"), 30, 140, 200, 8, T("E&xport nach HTML", "E&xport into HTML")) [ SELECT: EndTXN BeginTXN(READ) TRUE GetObjectsSelected(, FoundObjectsWinListBox) # Cardinality if TRUE else FALSE Widget(, FoundObjectsWinListBox) httpTools::ExportObjectListIntoFile ]

Parameters for calling httpTools::ExportObjectListIntoFile:

TopDefinition of the ListBox or TreeBox widget to be used for exporting the list.
Top - 1TRUE - Only the selected items will be exported.
FALSE - All items in the list are exported.
Top - 2

TRUE - List headers are taken over
FALSE - Without list headers

Definition : Query database

There are reports that need to be called up recurrently. For example, a report of orders that have been delivered but not yet invoiced could be created weekly. This can be automated so that you do not have to call up the same list and select the same selection criteria each time. For this purpose, there is the function "Query database" in the reports module.

From the user's point of view, the function works as follows. One opens the list module and selects the search criteria. Then open the reporting module and select a report or create a new report. When editing the report, one can automatically create the "Commands for querying the database". The report fetches the search criteria from the list module in the form of commands, which are later sent automatically. The user is thus able to save the report under his favourites and have it executed automatically.

For this to work, the following macros must be defined when writing the module.

The report-dependent list requires the message SELECT_EXECUTES_TO_CREATE_DATA_COLLECTION, which calls the macro SelectExecutesToCreateDataCollection.

Definition of report-dependent list
ObjectListView(HiddenReportListBox, HIDDEN, SELECT_MULTIPLE, AUTO_POSITION, 7, , 79, 561, 120) [ INITIALIZE : Widget SetHiddenReportListBox ... SELECT_EXECUTES_TO_CREATE_DATA_COLLECTION: SelectExecutesToCreateDataCollection ]

To implement the functionality, it is recommended to use a macro SelectExecutesToCreateDataCollection_SetTestMsg, which prepares the commands to be executed and defines the test massage.

The following paragraphs are then to be inserted in the main macro SelectExecutesToCreateDataCollection:

  • Open the list window if it is not already open.
  • Emptying the search macro
  • Read out the search arguments and convert them into execute commands.
  • Opening the reporting module
  • Selecting the report in the reporting module
Macros for querying the database
Define(SelectExecutesToCreateDataCollection_SetTestMsg)   Substitute("\"", "\\\"") "\"" Swap + "\" SendMsg(TEST_PRODUCT)" + ; Define(SelectExecutesToCreateDataCollection)   -> sender   [] -> executeVector   CreateTransObject(CX_TRANSACTION) Dup -> tmpExecuteTxn executeVector Insert   T("Listenfenster öffnen") tmpExecuteTxn Put(mlShortName)   "Widget(SelectWin) Call(IsOpen) ifnot { NULL SendMsg(LIST_PRODUCT) }" SelectExecutesToCreateDataCollection_SetTestMsg tmpExecuteTxn Put(system.comment)   CreateTransObject(CX_TRANSACTION) Dup -> tmpExecuteTxn executeVector Insert   T("Suchmaske leeren") tmpExecuteTxn Put(mlShortName)   "ClearWindow(SelectWin, ListBoxHeaderGroup)" SelectExecutesToCreateDataCollection_SetTestMsg tmpExecuteTxn Put(system.comment)   GetValue(, UniqueIDStr) Truncate Cardinality if   {     CreateTransObject(CX_TRANSACTION) Dup -> tmpExecuteTxn executeVector Insert     T("Filter Nummer") tmpExecuteTxn Put(mlShortName)     "\"" GetValue(, UniqueIDStr) + "\" PutValue(SelectWin, UniqueIDStr) Widget(SelectWin, UniqueIDStr) SendMsg(SELECT,DIRECT)" +     SelectExecutesToCreateDataCollection_SetTestMsg tmpExecuteTxn Put(system.comment)   }   CreateTransObject(CX_TRANSACTION) Dup -> tmpExecuteTxn executeVector Insert   T("Reporting Fenster öffnen") tmpExecuteTxn Put(mlShortName)   "\"Widget(SelectWin,CopyClipboardButton) SendMsg(SELECT, DIRECT)\" SendMsg(TEST_PRODUCT)" tmpExecuteTxn Put(system.comment)   CreateTransObject(CX_TRANSACTION) Dup -> tmpExecuteTxn executeVector Insert   T("Report selektieren") tmpExecuteTxn Put(mlShortName)   "Var(tmpReport) Module \"reprtedt\" StringFind if { tmpReport \"Select(EditWin, Reports) Widget(EditWin, SwitchDataBaseBtn) SendMsg(SELECT, DIRECT)\" SendMsg(TEST_PRINT_REPORT) }"   tmpExecuteTxn Put(system.comment)   executeVector sender SendMsg(EXECUTES_TO_CREATE_DATA_COLLECTION_SELECTED, DIRECT) ;
Definition: Filtering database

When the report dialogue is called up, the current data in the list are used as the database or compiled by the steps in " Query database". Subsequently. This data is written to the "ObjectListView" object before the filtering is executed. You can manipulate this data with the commands in the filtering. It is possible to access the data of the list box directly via the variables objectList ( = ObjectListView) and parentWindow ( = Window).

Examples:
DescriptionCode
Load the collection of the list onto the stackobjectList parentWindow GetCollection(STACK, STACK)
Clear the list and write back the first entryobjectList parentWindow ClearObox(STACK, STACK) 0 Swap GetElement objectList parentWindow UpdateObox(STACK, STACK)

Definition: Saved list

In order for a saved list to be called directly from the Own saved lists window, the window with the list box must be able to receive an "EXEC_..." message. If a window cannot receive this message, saved lists can only be selected via the report window.